<template>
    <Header>
        <Menu mode="horizontal" theme="dark" active-name="1">
            <div class="layout-logo">
				运营管理平台
			</div>
            <div class="layout-nav">
                <div class="">
                    <Avatar src=""/>
                </div>
                <div class="">
                    <Dropdown style="margin-left: 20px" @on-click="clickDropdownItem">
                        <a href="javascript:void(0)">
                            欢迎您，{{adminInfo.username}}
                            <Icon type="ios-arrow-down"></Icon>
                        </a>
                        <DropdownMenu slot="list">
                           <!-- <DropdownItem name="editPassword">修改密码</DropdownItem> -->
                            <DropdownItem name="logout">退出登录</DropdownItem>
                        </DropdownMenu>
                    </Dropdown>
                </div>
            </div>
        </Menu>
        <!-- 修改密码 -->
      
    </Header>
</template>

<script>
// 
    export default {
        name: "top",
        data() {
            return {
                adminInfo: {
					username:'',
					userId:''
				}
            };
        },
        mounted() {
            // 查询管理员信息
            this.queryAdminInfo();
        },
        methods: {
            // 查询管理员信息
            queryAdminInfo() {
              let username= sessionStorage.getItem("userName");
			  this.adminInfo.username = username;
			   let userId= sessionStorage.getItem("userId");
			    this.adminInfo.userId = userId;
            },
            // 点击下拉按钮
            clickDropdownItem(res) {
                switch (res) {
                    case 'editPassword':
                        this.$refs.changePassword.show();
                        break;
                    case 'logout':
                        this.logout();
                        break;
                }
            },
            // 退出登录
            logout() {
                this.$Modal.confirm({
                    title: '提示信息',
                    content: '<p>您是否退出登录</p>',
                    loading: true,
                    onOk: () => {
						 this.$Message.success("退出成功！");
						this.$Modal.remove();
						this.$router.push("/");
                        // this.$http.post('/adminLogin/logout').then(res => {
                        //     if (res.status == 200) {
                        //         this.$Message.success("退出成功！");
                        //         this.$Modal.remove();
                        //         this.$router.push("/");
                        //     }
                        // });
                    }
                });
            }
        }
      
    }
</script>

<style scoped>
    .ivu-dropdown-item {
        text-align: center !important;
    }
.ivu-menu-horizontal{
	height: 84px;
	line-height: 84px;
}
    .ivu-dropdown-rel a{
        color: #000000 !important;
    }
	.ivu-menu-dark,.ivu-layout{
		background: #fff !important;
		
	}
	.ivu-layout-header{
		background: #fff !important;
		padding: 0 0;
		color: #000000;
		height: 84px;
		line-height: 84px;
	}
	.layout-logo{
		top: auto;
		left: auto;
		height: auto;
		width: 240px;
		min-width: 240px;
		max-width: 240px; 
		flex: 0 0 200px; 
		background:#00284D;
		text-align: center;
		font-size: 18px;
		color: #FFFFFF;
		font-weight: bold;
	}
	.layout-nav{
		margin-right: 40px;
	}
	.ivu-menu{
		color: #FFFFFF !important;
	}
</style>